package com.example.saveqq;

import android.os.Bundle;

import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;

import android.text.TextUtils;
import android.view.View;

import androidx.core.view.WindowCompat;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.example.saveqq.databinding.ActivityMainBinding;

import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    private EditText editText1,editText2;
    private Button button;
    private String name,password;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        editText1=findViewById(R.id.et1);
        editText2=findViewById(R.id.et2);
        button=findViewById(R.id.bt);
        button.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        name=editText1.getText().toString();
        password=editText2.getText().toString();
        if(TextUtils.isEmpty(name)){
            Toast.makeText(this, "请输入账号", Toast.LENGTH_SHORT).show();
        }else if(TextUtils.isEmpty(password)){
            Toast.makeText(this, "请输入密码", Toast.LENGTH_SHORT).show();
        }else{
            Toast.makeText(this, "登录成功", Toast.LENGTH_SHORT).show();
            FileSaveQQ.saveUserInfo(this,name,password);
        }
    }
}